﻿using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
using System;
namespace WPFExcelReport
{
    public partial class UISTKCHG : ViewBase
    {
        public UISTKCHG()
        {

        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            base.Window_Loaded(sender, e);
            FTAUTOSUM = true;
            TCOUNT1 = "行数";
            TKEY1 = "期初";
            SKEY1 = "LO";
            KEY1 = "BS00";
            TKEY2 = "期末";
            SKEY2 = "LO";
            KEY2 = "STOCKQTY";
        }

        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            if (dwMaster == null)
            {
                KEY = "";
            }
            else
            {
                KEY = dwMaster["LO"].ToString().Trim().PadRight(2) + dwMaster["LB"].ToString().Trim().PadRight(2)
                  + dwMaster["MDATE"].ToString().Trim().PadRight(8) + dwMaster["WAKZ"].ToString().Trim().PadRight(1) + dwMaster["ART"].ToString().Trim().PadRight(20)
                  + dwMaster["VAR"].ToString().Trim().PadRight(2) + dwMaster["FARBE"].ToString().Trim().PadRight(10) + dwMaster["FINISH"].ToString().Trim().PadRight(10)
                  + dwMaster["DESS"].ToString().Trim().PadRight(10)
                  + dwMaster["COLORIT"].ToString().Trim().PadRight(10) + dwMaster["FSIZE"].ToString().Trim().PadRight(7) + dwMaster["FBPART"].ToString().Trim().PadRight(10) + dwMaster["SPPART"].ToString().Trim().PadRight(10)
                  + dwMaster["ZWPART"].ToString().Trim().PadRight(10) + dwMaster["BEM1"].ToString().Trim().PadRight(40)
                  + dwMaster["BS"].ToString().Trim().PadRight(2);


            }
        }
    }
    public partial class UISTKCHG : ViewBase
    {
        public VICC_STOCKCHG TMV
        {
            get
            {
                return (VICC_STOCKCHG)MV;
            }
        }

        #region ==IsRange===========
        public static readonly DependencyProperty IsRangeProperty = DependencyProperty.Register("IsRange",
        typeof(bool), typeof(UISTKCHG),
        new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsRangeChanged));
        public bool IsRange
        {
            get
            {
                return (bool)GetValue(IsRangeProperty);
            }
            set
            {
                SetValue(IsRangeProperty, value);
            }
        }
        private static void OnIsRangeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UISTKCHG;
            if (src != null)
            {
                src.IsRange = (bool)e.NewValue;
            }
        }
        #endregion

    }
}
